package battleship;

import battleship.field.Field;
import battleship.view.Views;

public class ViewController {
	
	private boolean continueSetupBoats = true;
	private boolean continueAskPlayers = true;
	private boolean continueAskSize = true;
	
	public boolean getContinueAskPlayers()
	{
		return continueAskPlayers;
	}
	
	public void setContinueAskPlayers(boolean continueAsk)
	{
		this.continueAskPlayers = continueAsk;
	}
	
	public boolean getContinueSetupBoats()
	{
		return continueSetupBoats;
	}
	
	public void setContinueSetupBoats(boolean continueSetup)
	{
		this.continueSetupBoats = continueSetup;
	}
	
	public void setContinueAskSize(boolean continueSize)
	{
		this.continueAskSize = continueSize;
	}
	
	public void displayNotification(String note)
	{
		if(Controller.getGUI() == Views.GUI)
		{
			Controller.getWindow().displayNotification(note);
			//TODO: more ways of displaying in GUI
		}
		else
		{
			Controller.getConsole().displayNotification(note);
		}
	}
	
	public void displayError(String error, PluginLoop plugin) {
		if(Controller.getGUI() == Views.GUI) {
			Controller.getWindow().displayError(error, plugin);
		}
		else {
			Controller.getConsole().displayError(error, plugin);
		}
	}
	
	public void displayHeader(String header)
	{
		if(Controller.getGUI() == Views.GUI)
		{
			Controller.getWindow().displayHeader(header);
		}
		else
		{
			Controller.getConsole().displayHeader(header);
		}
	}
	
	public void printBoard(boolean showall, Field field)
	{
		if(Controller.getGUI() == Views.GUI)
		{
			Controller.getWindow().updateBoard(showall, field);
		}
		else
		{
			Controller.getConsole().printBoard(showall, field);
		}
	}

	public boolean getContinueAskSize() {
		
		return continueAskSize;
	}
}
